#ifndef MANAGER_H
#define MANAGER_H


#include <string>
#include <iostream>
using namespace std;

#include <time.h>

#include "Grid.h"
#include "Tetrimino.h"
#include "DxManager.h"

#define ROTATE_WAIT 0.3
#define IMPRINT_WAIT 0.5
#define SHOOT_WAIT 0.4

#define GRID_WIDTH		300
#define GRID_HEIGHT		600

class Manager
{
private:
	DxManager dxm;
	HWND wHandle;
	Grid* grid;
	Tetrimino* tetri;
	Tetrimino* hold;
	int holdCount; //forces you to only be able to hold once per drop
	double last_t;
	int CurrX;
	int CurrY;
	int score;
	int lines;
	bool End;
	IDirect3DSurface9* background;
	IDirect3DSurface9* gridOutline;
	RECT srcRect;
	RECT destRect;
	RECT gridSrc;
	RECT gridDest;
	RECT swapSrc;
	RECT swapDest;


	int mX;
	int mY;

	string BulletText;
	string LineText;
	string ScoreText;
	int Bullets;

	char bulletparse[5];
	char pointparse[10];

	LPDIRECTSOUNDBUFFER shot;
	LPDIRECTSOUNDBUFFER music;
	

	bool rColl();
	bool lColl();
	bool tColl();
public:
	Manager(HWND wndHandle, HINSTANCE hInstance);
	~Manager();
	void ReInit();
	void ReInitHold();
	void InitDraw();
	void Draw();
	bool Input(double ptime, double c_time);
	void Update(double);
	void UpdateRows();
	void Imprint();
	void DestroyBlock();
	bool Stop();
	bool GameEnd() { return End; }
};

#endif
